<template>
  <div class="bar" @click="barclick">
    MyBar

    {{ $store.state.name }}
    <button @click="$store.dispatch('changeName')">改变名字</button>
  </div>
</template>

<script>
export default {
  asyncData(store) {
    //
  },
  methods: {
    barclick() {
      console.log("点击bar");
    },
  },
};
</script>

<style>
.bar {
  background: yellow;
  color: red;
}
</style>
